          <?php $errorDim = Yii::app()->user->hasFlash('errorDim') ? unserialize(Yii::app()->user->getFlash('errorDim')) : null ?>
          <!-- START OF MAINCOL -->
          <div class="MainCol AddEbookPage">
          	  <h1>编辑心理测试维度</h1>
              <div class="right"><a href="#add_dim" class="Blue_btn" title="add new ebook"><span><?= CHtml::image(Yii::app()->baseUrl.'/images/add_icon.gif', '', array('class' => 'icon')); ?> 添加新维度</span></a>
              </div>
              <span class="NormalFont SmallFont">
                  <?= CHtml::image(Yii::app()->baseUrl.'/images/home_icon.gif', '主页'); ?> > 心理测试管理 > 编辑心理测试主题 > 编辑心理测试维度
               </span><br /><br />
              <div class="Titlebox box"><!-- DON'T DELETE --></div>

                <h4 id="add_dim">“<?php echo htmlspecialchars($topic->topicTitle) ?>”的维度</h4>
                
              <?php if(Yii::app()->user->hasFlash('successMessage')) : ?>
              <div class="SuccessfulBox Smallbox">
                <span class="Successful"> <?php echo Yii::app()->user->getFlash('successMessage'); ?></span>
              </div>
              <?php endif; ?>

			<?php $i = 0 ?>
			<?php foreach($dims as $dim) : ?>
			<?php $i++ ?>
              <div class="Smallbox"><label>序号</label>
                  <?php echo $i ?>
                  <?php echo CHtml::link('&nbsp;', array('/admin/psytest/deletedim', 'id' => $dim->dimensId), array('style' => 'float: right;', 'class' => 'Delete', 'confirm' => '确定要删除该维度吗？')) ?>
              </div>
              
              <div class="Smallbox"><label>标识<span class="Red">*</span></label>
                  <?php echo $dim->sku ?>
              </div>

              <div class="Smallbox"><label>说明</label>
              	<span class="dim-descr" id="dim_descr_<?php echo $dim->dimensId ?>"><?php echo htmlspecialchars($dim->dimensDescr); ?></span>
              </div>
            <?php endforeach ?>
                <hr />
                <h3 id="add_dim">添加新维度</h3>
	            <?php if($errorDim !== null) : ?>
	            <?php echo CHtml::errorSummary($errorDim) ?>
	            <?php endif ?>

              <?php echo CHtml::form(array('/admin/psytest/adddim')); $_dim->topicId = $topic->topicId ?>
              <?php echo CHtml::activeHiddenField($_dim, 'topicId') ?>
              <div class="Smallbox"><label>标识<span class="Red">*</span></label>
                  <?php echo CHtml::activeTextfield($_dim, 'sku') ?> 只能由字母或者数字组成
              </div>

                <div class="Smallbox"><label>说明<span class="Red">*</span></label>
                  <?php echo CHtml::activeTextfield($_dim, 'dimensDescr') ?>
              </div>

              <div class="Smallbox btnBox"><label>&nbsp;</label>
              <?= CHtml::submitButton('提交'); ?>
              </div>
              <?php echo CHtml::endForm() ?>
              <div class="Smallbox btnBox"><label>&nbsp;</label>
              <?= CHtml::link('返回', array('admin/psytest/edittopic', 'id' => $topic->topicId)); ?>
              </div>
          </div>
          <!-- END OF MAINCOL -->
<script type="text/javascript">
$(document).ready(function() {
	$('.dim-descr').editable('<?php echo $this->createAbsoluteUrl('/admin/psytest/updatedim') ?>', {
         type      : 'text',
         cancel    : '取消',
		 width    : '144px',
         submit    : '确定',
         indicator : '<img src="<?php echo Yii::app()->baseUrl.'/images/ajax-loader.gif' ?>">',
         tooltip   : '单击进行编辑...'
     });
});
</script>
